package org.example.everyday;

public class Lc537 {
    public String complexNumberMultiply(String num1, String num2) {
        String[] complex1 = num1.split("\\+|i");
        String[] complex2 = num2.split("\\+|i");
        int real1 = Integer.parseInt(complex1[0]);
        int imag1 = Integer.parseInt(complex1[1]);
        int real2 = Integer.parseInt(complex2[0]);
        int imag2 = Integer.parseInt(complex2[1]);
        return String.format("%d+%di",real1 * real2 - imag1 * imag2,real1 * imag2 +imag1 * real2);
    }

    public static void main(String[] args) {
        Lc537 lc537 = new Lc537();
        String result = lc537.complexNumberMultiply("1+1i","1+1i");
        System.out.println(result);
    }

}
